package hu.sulirend.model;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

/**
 * Contains members of the Clazz.
 * 
 * @see <code>hu.sulirend.model.ClazzGroups</code>
 * @see <code>hu.sulirend.model.StudentGroup</code>
 * @see <code>hu.sulirend.model.Student</code>
 *
 * @author <a href="mailto: peter.szilagyi@gmail.com">Peter Szilagyi</a> 
 * @since 2008
 */
@Entity
public class Membership extends BaseEntity {

	private static final long serialVersionUID = -7339449372244591978L;
	
	private Set<Student> students;

	@ManyToMany(fetch=FetchType.LAZY, cascade={})
	@JoinTable(name="STUDENT_MEMBERSHIP", 
			joinColumns=@JoinColumn(name="MEMBERSHIP_ID", referencedColumnName="id", columnDefinition="INTEGER"),
			inverseJoinColumns=@JoinColumn(name="STUDENT_ID", referencedColumnName="id", columnDefinition="INTEGER")
	)
	public Set<Student> getStudents() {
		return students;
	}
	public void setStudents(Set<Student> students) {
		this.students = students;
	}
	
}
